(function (angular) {
    'use strict';

    var module = angular.module('sinbad.filter', ['ngResource']);

    module.filter('platform', function () {
        var mappings = ["综合","PC","移动"];
        return function (input, type) {
            if (input >= mappings.length) {
                input = 0;
            }
            return mappings[input];
        };
    });

    module.filter('days', function () {
        var mappings = [];
        mappings[1] = "昨天";
        mappings[3] = "最近三天";
        mappings[7] = "最近一周";
        mappings[15] = "最近半个月";
        mappings[30] = "最近一个月";
        mappings[90] = "最近三个月";
        return function (input, type) {
            if (input >= mappings.length) {
                input = 1;
            }
            return  mappings[input];
        };
    });

    module.filter('name',function(){
        var mappings = ["展现量","点击量","平均点击花费","点击率","点击转化率","宝贝排名","质量总分","总花费"];
        return function (input, type) {
            if (input >= mappings.length) {
                input = 1;
            }
            return mappings[input];
        };
    });

    module.filter('promorename', function () {
        var mappings = ["展现量","总花费","CPC","直接成交额","间接成交额","总收藏数","收藏店铺数","总成交额","点击转化率","间接购物车数","平均展现排名","点击量","点击率","千次展现花费","直接成交笔数","间接成交笔数","收藏宝贝数","ROI","总成交笔数","直接购物车数","总购物车数","添加时间"];
        return function (input ,type){
            if(input == 'zxl') input=0;
            if(input == 'zhf') input=1;
            if(input == 'cpc') input=2;
            if(input == 'zjcje') input=3;
            if(input == 'jjcje') input=4;
            if(input == 'zscs') input=5;
            if(input == 'scdps') input=6;
            if(input == 'zcje') input=7;
            if(input == 'djzhl') input=8;
            if(input == 'jjgwcs') input=9;
            if(input == 'pjzxpm') input=10;
            if(input == 'djl') input=11;
            if(input == 'djv') input=12;
            if(input == 'qczxhf') input=13;
            if(input == 'zjcjbs') input=14;
            if(input == 'jjcjbs') input=15;
            if(input == 'scbbs') input=16;
            if(input == 'roi') input=17;
            if(input == 'zcjbs') input=18;
            if(input == 'zjgwcs') input=19;
            if(input == 'zgwcs') input=20;
            if(input == 'tjsj') input=21;
            return  mappings[input];
        };
    });

})(angular);